/**
 * <p>Title: ServiceZMCEFA.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张志芳
 * @version 1.0
 * <pre>Histroy:
 *          2012-1-17 上午10:11:53  张志芳  Create
 *</pre>
 */
package com.baosight.sczx.zm.ce.service;

import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.threadlocal.UserSession;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.zm.basetools.StaticTools;
import com.baosight.sczx.common.zm.cInterface.Department;
import com.baosight.sczx.common.zm.cInterface.User;
import com.baosight.sczx.common.zm.cInterface.ce.Equipment;
import com.baosight.sczx.zm.ce.domain.ZMCEUnusualProblem;

/**
 * 异常记录——台账
 * <p>Title: ServiceZMCEFA.java</p>
 * <p>Description: </p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 张志芳
 * @version 1.0
 * <pre>Histroy:
 *          2012-1-17 上午10:11:53  张志芳  Create
 *</pre>
 */
public class ServiceZMCEFA extends ServiceEPBase {

	/**
	 * <p>Function: initLoad</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCEU0</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2012-1-16下午02:43:48 张志芳 
	 * </p>
	 *
	*/
	@Override
	public EiInfo initLoad(EiInfo inInfo) {
		inInfo.addBlock(EiConstant.resultBlock).set("showCount", "true");//如果不加这个，翻页的统计和显示是错误的
		EiInfo outInfo = this.query(inInfo);
		outInfo.addBlock(Equipment.getEquipmentBlock("cmes.ce.equipment", null));
		outInfo.addBlock(Department.getInstance().getConstructionUnit("cmes.ce.department", "orgCode", "orgName", false));
		outInfo.addBlock(Department.getInstance().getConstructionUnit("cmes.ce.departmentWithSpace", "orgCode", "orgName", true));		
		outInfo.addBlock(User.getInstance().getConstructionStaff("cmes.ce.people", "empCode", "empName", false));
		
		outInfo.set("person", UserSession.getInSessionProperty("UserCname"));
		return outInfo;
	}

	/**
	 * <p>Function: query</p>
	 * <p>Description: </p>
	 * <p>return value: ServiceZMCEU0</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2012-1-16下午02:43:48 张志芳 
	 * </p>
	 *
	*/
	@Override
	public EiInfo query(EiInfo inInfo) {
		String fdEquipmentId = inInfo.getString("fdEquipmentId");
		StaticTools.setQueryParameters(inInfo, "fdEquipmentId", fdEquipmentId, true);//添加查询条件			
		EiInfo outInfo = super.query(inInfo, "ZMCEUnusualProblem.query", new ZMCEUnusualProblem());		
		return outInfo;
	}
}
